package com.cdu.controller;

import com.cdu.pojo.entity.Address;
import com.cdu.service.AddressService;
import com.cdu.commons.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/address")
public class AddressController {

    @Autowired
    private AddressService addressService;

    @PostMapping("add")
    public R<Void> addAddress(@Validated @RequestBody Address address) {
        // 调用业务层方法添加地址
        return addressService.addAddress(address);
    }
}